package com.learn.twoday;

import org.apache.log4j.Logger;

import java.util.concurrent.TimeUnit;

/**
 * @author ln
 * @Description: ${todo}
 * @date 2020/12/9
 */
public class SleepTestTwo {

    private static final Logger logger=Logger.getLogger(SleepTestTwo.class);

    public static void main(String[] args) {
        Thread t2=new Thread(
                ()->{
                    logger.info("线程要执行的任务,t2线程开始执行");
                    try {
                        TimeUnit.SECONDS.sleep(3);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    logger.info("t2线程睡眠3秒后醒来");
                }
                ,"t2线程");
        t2.start();

        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        logger.info("main线程睡眠1秒后醒来");
    }


}
